package models

func (db *DbWrapper) GetBuildingConfig(id int) *BuildingConfigs {
	u1 := new(BuildingConfigs)
	db.DbInstance.Where("id=?", id).First(&u1)
	return u1
}

func (db *DbWrapper) GetBuildingStep(id int) *BuildingSteps {
	u1 := new(BuildingSteps)
	db.DbInstance.Where("id=?", id).First(&u1)
	return u1
}

func (db *DbWrapper) GetSpecBuildingStep(bid int, step int) *BuildingSteps {
	u1 := new(BuildingSteps)
	db.DbInstance.Where("bid=? and step=?", bid, step).First(&u1)
	return u1
}

func (db *DbWrapper) GetBuildingSkin(id int) *BuildingSkins {
	u1 := new(BuildingSkins)
	db.DbInstance.Where("id=?", id).First(&u1)
	return u1
}

func (db *DbWrapper) GetBuildingSkinByBidAndSid(bid, sid int) *BuildingSkins {
	u1 := new(BuildingSkins)
	db.DbInstance.Where("bid=? and skin=?", bid, sid).First(&u1)
	return u1
}

func (db *DbWrapper) GetBuildingLevel(id int) *BuildingLevels {
	u1 := new(BuildingLevels)
	db.DbInstance.Where("id=?", id).First(&u1)
	return u1
}

func (db *DbWrapper) GetSpecBuildingLevel(lv int) *BuildingLevels {
	u1 := new(BuildingLevels)
	db.DbInstance.Where("lv=?", lv).First(&u1)
	return u1
}

func (db *DbWrapper) GetDictItem(id int) *DictItems {
	u1 := new(DictItems)
	db.DbInstance.Where("id=?", id).First(&u1)
	return u1
}

func (db *DbWrapper) GetBuildingConfigs() []*BuildingConfigs {
	var items []*BuildingConfigs
	db.DbInstance.Find(&items)
	return items
}

func (db *DbWrapper) GetBuildingSteps(id int) []*BuildingSteps {
	var items []*BuildingSteps
	db.DbInstance.Find(&items)
	return items
}

func (db *DbWrapper) GetBuildingSkins(id int) []*BuildingSkins {
	var items []*BuildingSkins
	db.DbInstance.Find(&items)
	return items
}

func (db *DbWrapper) GetBuildingLevels(id int) []*BuildingLevels {
	var items []*BuildingLevels
	db.DbInstance.Find(&items)
	return items
}

func (db *DbWrapper) GetDictItems(id int) []*DictItems {
	var items []*DictItems
	db.DbInstance.Find(&items)
	return items
}

func (db *DbWrapper) GetGlobalParam() *ParameterConfigs {
	u1 := new(ParameterConfigs)
	db.DbInstance.First(&u1)
	return u1
}
